package com.example.myapplication.ui

import android.content.Intent
import android.os.Bundle
import android.os.PersistableBundle
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentTransaction
import androidx.recyclerview.widget.RecyclerView
import com.example.myapplication.R


class HomeActivity: AppCompatActivity() {

    var quickAdapterFragment:Fragment = QuickFragment()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_home)
        initFragment()
        switchFragment()
    }




    private fun switchFragment() {
        var transaction=supportFragmentManager.beginTransaction()
        var intent:Intent = getIntent()
        var catagory:String =intent.getStringExtra("catagory")
        if("quick_adapter" == catagory ){
            transaction?.show(quickAdapterFragment)
        }
        transaction?.commit()
    }

    private fun initFragment() {
        var transaction=supportFragmentManager.beginTransaction()
        transaction?.add(R.id.fl_container,quickAdapterFragment)
        transaction?.hide(quickAdapterFragment)
        transaction?.commit()
    }
}